<?php
class Stream extends Record{
    protected $nodes = array();

    public function setTableDefinition() {
        $this->setTableName("streams");

        $this->hasIdColumn();
        $this->hasReferenceColumn("url_id", TRUE);
        $this->hasReferenceColumn("site_id", TRUE);

        $this->hasColumn("title", "string", array(
            "length" => LENGTH_DESCRIPTION
        ) );
        $this->hasColumn("language", "string", array(
            "length" => LENGTH_LANGUAGE_CODE
        ) );

        $this->hasColumn("last_update_time", "integer", array( "length" => 32 ) );
    }
    
    public function setUp() {
        $this->hasMany("Stream_Node as nodes", array(
            "local" => "id",
            "foreign" => "stream_id"
        ) );
    }

}